package com.neusoft.aop;

import org.aspectj.lang.ProceedingJoinPoint;

/**
 * 当前切面，记住要到Spring中配置
 * @Author: duan
 * @Date: Create in 11:28 2020/10/31
 */

public class ServiceAspect {
    public void before() {
        System.out.println("前置增强");
    }

    public void after() {
        System.out.println("后置增强");
    }

    public void afterReturning() {
        System.out.println("方法返回后");
    }

    public void throwException() {
        System.out.println("方法抛出异常后");
    }

    //ProceedingJoinPoint：正在进行的连接点对象
    public Object around(ProceedingJoinPoint pjp) throws Throwable {
        System.out.println("方法环绕1");
        Object proceed = pjp.proceed();//方法执行
        System.out.println("方法环绕2");
        System.out.println("proceed:::" + proceed);
        return proceed;
    }
}
